package com.spring.security.core.social.qq.connet;

import com.spring.security.core.social.qq.entity.QQUserInfo;
import com.spring.security.core.social.qq.service.QQInfo;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;

/**
 * @author_seabed_moon
 */
public class QQAdapter implements ApiAdapter<QQInfo> {

    @Override
    public boolean test(QQInfo api) {
        return true;
    }

    @Override
    public void setConnectionValues(QQInfo api, ConnectionValues values) {
        QQUserInfo userInfo = api.getUserInfo();

        values.setDisplayName(userInfo.getNickname());
        values.setImageUrl(userInfo.getFigureurl_qq_1());
        values.setProfileUrl(null);
        values.setProviderUserId(userInfo.getOpenId());
    }

    @Override
    public UserProfile fetchUserProfile(QQInfo api) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public void updateStatus(QQInfo api, String message) {
        //do noting
    }

}
